package org.iabako.shared.iservice.business;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.iabako.shared.entity.business.AbstractEntity;
import org.iabako.shared.entity.business.Payment;
import org.iabako.shared.entity.business.Sale;
import org.iabako.shared.iservice.generic.CRUDServiceAsync;
import org.iabako.shared.iservice.generic.SearchServiceAsync;

import java.util.List;

/**
 * Created by jose on 28/08/14.
 */
public interface PaymentServiceAsync extends SearchServiceAsync, CRUDServiceAsync {

    void getBySale(Sale entity, AsyncCallback<List<Payment>> async);

    void save(Payment payment, AsyncCallback<Payment> async);

    void save(Payment payment, boolean noTrack, AsyncCallback<Payment> async);

    void remove(Payment payment, boolean noTrack, AsyncCallback<Boolean> async);

    public static final class Util {
        private static PaymentServiceAsync instance;

        public static final PaymentServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(PaymentService.class);
            }
            return instance;
        }
    }
}
